$time = $db_zugriff->query_first("SELECT timelastreply as time FROM bb".$n."_threads WHERE threadid='$threadid'");
if($goto == "nextoldest") $nextthread = $db_zugriff->query_first("SELECT threadid FROM bb".$n."_threads WHERE timelastreply < '".$time[time]."' AND boardparentid='$boardid' ORDER by timelastreply DESC LIMIT 1");
if($goto == "nextnewest") $nextthread = $db_zugriff->query_first("SELECT threadid FROM bb".$n."_threads WHERE timelastreply > '".$time[time]."' AND boardparentid='$boardid' ORDER by timelastreply ASC LIMIT 1");
$threadid = $nextthread[threadid];
}
$thread_info = $db_zugriff->query_first("SELECT * FROM bb".$n."_threads WHERE threadid = '$threadid'");
$getpostids=$db_zugriff->query("SELECT postid FROM bb".$n."_posts WHERE bb".$n."_posts.threadparentid='$threadid' ORDER by bb".$n."_posts.posttime ".ifelse($postorder,"DESC","ASC")." LIMIT ".($eproseite*($page-1)).",".($eproseite));